/*    */ package com.cr.framework.config;
/*    */ 
/*    */ import com.cr.common.utils.MyStringUtils;
/*    */ import com.cr.common.xss.XssFilter;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import javax.servlet.DispatcherType;
/*    */ import javax.servlet.Filter;
/*    */ import org.springframework.beans.factory.annotation.Value;
/*    */ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
/*    */ import org.springframework.boot.web.servlet.FilterRegistrationBean;
/*    */ import org.springframework.context.annotation.Bean;
/*    */ import org.springframework.context.annotation.Configuration;
/*    */ 
/*    */ @Configuration
/*    */ @ConditionalOnProperty(value = {"xss.enabled"}, havingValue = "true")
/*    */ public class FilterConfig {
/*    */   @Value("${xss.excludes}")
/*    */   private String excludes;
/*    */   
/*    */   @Value("${xss.urlPatterns}")
/*    */   private String urlPatterns;
/*    */   
/*    */   @Bean
/*    */   public FilterRegistrationBean xssFilterRegistration() {
/* 33 */     FilterRegistrationBean registration = new FilterRegistrationBean();
/* 34 */     registration.setDispatcherTypes(DispatcherType.REQUEST, new DispatcherType[0]);
/* 35 */     registration.setFilter((Filter)new XssFilter());
/* 36 */     registration.addUrlPatterns(MyStringUtils.split(this.urlPatterns, ","));
/* 37 */     registration.setName("xssFilter");
/* 38 */     registration.setOrder(-2147483648);
/* 39 */     Map<String, String> initParameters = new HashMap<>();
/* 40 */     initParameters.put("excludes", this.excludes);
/* 41 */     registration.setInitParameters(initParameters);
/* 42 */     return registration;
/*    */   }
/*    */ }


/* Location:              D:\tmp\creditorRights-admin\BOOT-INF\lib\creditorRights-framework-4.7.0.jar!\com\cr\framework\config\FilterConfig.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */